package com.wc.算法提高课.A第一章_动态规划.斜率优化DP.任务安排3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/5/14 20:27
 * @description https://www.acwing.com/problem/content/304/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 300010;
    static long[] t = new long[N], c = new long[N];
    static long[] f = new long[N];
    static int[] q = new int[N];
    static int n, s;

    // 因为斜率不是单调递增的了, 所以我们不能通过删除来做, 只能通过二分来做
    public static void main(String[] args) {
        n = sc.nextInt();
        s = sc.nextInt();
        for (int i = 1; i <= n; i++) {
            t[i] = sc.nextInt();
            c[i] = sc.nextInt();
            t[i] += t[i - 1];
            c[i] += c[i - 1];
        }
        int hh = 1, tt = 0;
        q[++tt] = 0;
        for (int i = 1; i <= n; i++) {
            int l = hh, r = tt;
            while (l < r) {
                int mid = l + r >> 1;
                // 找到第一个满足斜率大于当前的位置
                if (f[q[mid + 1]] - f[q[mid]] > (c[q[mid + 1]] - c[q[mid]]) * (t[i] + s)) r = mid;
                else l = mid + 1;
            }

            int j = q[r];
            f[i] = f[j] - (t[i] + s) * c[j] + t[i] * c[i] + s * c[n];
            // 删除尾部的凸包 (f[tt] - f[tt - 1]) / c[tt] - c[tt - 1] > (f[i] - f[tt]) / (c[i] - c[tt]);
            while (hh < tt && (double) (f[q[tt - 1]] - f[q[tt]]) * (c[q[tt]] - c[i]) >= (double) (c[q[tt - 1]] - c[q[tt]]) * (f[q[tt]] - f[i]))
                tt--;
            q[++tt] = i;
        }
        out.println(f[n]);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
